
<style>
    .form-horizontal .form-group{margin-right: -50px;}
    .col-sm-8{padding-right: 0;}
	.tm .btn { margin-bottom:5px;}
</style>
<div class="page-content">
    <div class="row">
        <div class="col-sm-8">
            <div class="">
                <div class="summary_box">
                    <div class="summary_title">
                        <span class="title_inner">短信模板说明</span>
                    </div>
                    <div class="summary_lg">
                        <p>模板名称：自定义填写，便于后台搜索查询选择。</p>
                        <p>模板ID：聚合数据、阿里大于需在服务商申请短信模板并审核，模板ID处填写服务商申请的模板ID。</p>
                        <p>短信签名: 阿里大于需在服务商申请短信签名并审核，短信签名处填写服务商申请的短信签名</p>
                        <p>数据值：聚合数据、阿里大于需在数据值中填写服务商模板变量对应的商城的变量(可在右侧选择商城变量)。</p>
                        
                        <p>状态：商城短信模板状态，关闭后将不能选择此模板，关闭后仍可在模板列表发送测试短信。</p>
                        <p class="text-danger">注意：阿里大于同一手机号60秒内只能发送一次，请根据需求选择适当接口。</p>
                    </div>
                </div>
            </div>
            <form action="" method="post" class="form-horizontal form-validate" enctype="multipart/form-data">
            <input type="hidden" name="template" value="" />
            <div class="form-group" style="margin-top:20px">
                <label class="col-xs-12 col-sm-3 col-md-2 right-label" >模板名称</label>
                <div class="col-xs-12 col-sm-8 col-lg-9">
                    <input type="text" name="name" ng-model="pagedata.item.name" class="form-control" value="" placeholder="模版名称，例：订单创建成功通知（自定义）" data-rule-required='true' />
                    
                </div>
            </div>

            <div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 right-label" >服务商</label>
					<div class="col-xs-12 col-sm-8 col-lg-9">
                    <select id="selecttemplate"  class=" form-control" style="margin-bottom: 5px;" ng-model="pagedata.item.type">
                     <option   value="1">阿里大鱼</option>
					  <option   value="2">聚合短信</option>
					</select>
                    </div>
             </div>

            <div class="form-group sms-template-1" >
                <label class="col-xs-12 col-sm-3 col-md-2 right-label" >模板ID</label>
                <div class="col-xs-12 col-sm-8 col-lg-9">
                  
                    <input type="text" name="smstplid" class="form-control" value="" ng-model="pagedata.item.smstplid" placeholder="短信模板ID，例：1234（短信服务商提供的模板ID）" data-rule-required='true' />
                    <div class="help-block">服务商提供的模板ID</div>           
                </div>
            </div>
            <div class="form-group splitter sms-template-1"></div>
            <div class="form-group sms-template-1" >
                <label class="col-xs-12 col-sm-3 col-md-2 right-label"></label>
                <div class="col-xs-12 col-sm-8 col-lg-9">
                    <a class="btn btn-default btn-add-type" href="javascript:;" ng-click="add();"><i class="fa fa-plus" title=""></i> 增加一条数据值</a>
					<div class="help-block">商城变量替换模板变量，例如：模版变量=ordensn 商城变量=[订单编号]，<span class="text-danger">仅填英文变量即可</span></div>
                </div>
            </div>
		<div class="form-group" >
                <label class="col-xs-12 col-sm-3 col-md-2 right-label"></label>
				<div class="input-group col-xs-12 col-sm-8 col-lg-9" style="margin: 0;">
					<span class="input-group-addon">模版变量</span>
					<input ng-model="pagedata.item.data.m1" type="text" class="form-control"></input>
					<span class="input-group-addon" style="border-left: 0; border-right: 0;">商城变量</span>
					<input id="s1" ng-model="pagedata.item.data.s1" type="text" class="form-control"></input >
				</div>
		</div>
		<div class="form-group" ng-show="pagedata.i>=1 || pagedata.item.data.m2" >
                <label class="col-xs-12 col-sm-3 col-md-2 right-label"></label>
				<div class="input-group col-xs-12 col-sm-8 col-lg-9" style="margin: 0;" >
					<span class="input-group-addon">模版变量</span>
					<input ng-model="pagedata.item.data.m2" type="text" class="form-control"></input>
					<span class="input-group-addon" style="border-left: 0; border-right: 0;">商城变量</span>
					<input id="s2" ng-model="pagedata.item.data.s2" type="text" class="form-control"></input >
				</div>
		</div>
		<div class="form-group" ng-show="pagedata.i>=2 || pagedata.item.data.m3" >
                <label class="col-xs-12 col-sm-3 col-md-2 right-label"></label>
				<div class="input-group col-xs-12 col-sm-8 col-lg-9" style="margin: 0;" >
					<span class="input-group-addon">模版变量</span>
					<input ng-model="pagedata.item.data.m3" type="text" class="form-control"></input>
					<span class="input-group-addon" style="border-left: 0; border-right: 0;">商城变量</span>
					<input id="s3" ng-model="pagedata.item.data.s3" type="text" class="form-control"></input >
				</div>
		</div>
		<div class="form-group" ng-show="pagedata.i>=3 || pagedata.item.data.m4">
                <label class="col-xs-12 col-sm-3 col-md-2 right-label"></label>
				<div class="input-group col-xs-12 col-sm-8 col-lg-9" style="margin: 0;" >
					<span class="input-group-addon">模版变量</span>
					<input ng-model="pagedata.item.data.m4" type="text" class="form-control"></input>
					<span class="input-group-addon" style="border-left: 0; border-right: 0;">商城变量</span>
					<input id="s4" ng-model="pagedata.item.data.s4" type="text" class="form-control"></input >
				</div>
		</div>
		<div class="form-group" ng-show="pagedata.i>=4 || pagedata.item.data.m5">
                <label class="col-xs-12 col-sm-3 col-md-2 right-label"></label>
				<div class="input-group col-xs-12 col-sm-8 col-lg-9" style="margin: 0;" >
					<span class="input-group-addon">模版变量</span>
					<input ng-model="pagedata.item.data.m5" type="text" class="form-control"></input>
					<span class="input-group-addon" style="border-left: 0; border-right: 0;">商城变量</span>
					<input id="s5" ng-model="pagedata.item.data.s5" type="text" class="form-control"></input >
				</div>
		</div>
            <div class="form-group" style="margin-top:20px">
                <label class="col-xs-12 col-sm-3 col-md-2 right-label" >状态</label>
                 <div class="col-xs-12 col-sm-8 col-lg-9">
                    <label class="right-label">
						<div ng-show="pagedata.item.status==1" class="switch switchOn" ng-click="pagedata.item.status=0"></div>
						<div ng-show="pagedata.item.status!=1" class="switch" ng-click="pagedata.item.status=1"></div>
					</label>
				</div>
            </div>

			<div class="modal-sub"><button class="btn btn-primary"  href="javascript:" id="showTooltips" ng-click="post(pagedata.item,'post')">提交</button></div>
            </form>

        </div>
        <div class="col-sm-4">
            <div class="panel panel-default" style="width:240px;margin-left:20px;">
                <div class="panel-heading">
                    <select class="form-control" onclick="$('.tm').hide();$('.tm-' + $(this).val()).show()">
                        <option value="">选择模板变量类型</option>
                        <option value="order">订单类</option>
                        <option value="upgrade">升级类</option>
                        <option value="rw">充值提现类</option>
                       
                        <option value="commission">分销类</option>
                      
                        <option value="globonus">股东类</option>
                       
                        <option value="merch">多商户类</option>
                    
                        <option value="login">登录/注册类</option>
                    </select>
                </div>
                <div class="panel-body tm tm-upgrade" style="display:none">
                    <a href='JavaScript:' class="btn btn-default  btn-sm ">商城名称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">粉丝昵称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">旧等级</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">新等级</a>
                </div>
                <div class="panel-heading tm tm-rw" style="display:none">充值</div>

                <div class="panel-body tm tm-rw" style="display:none">
                    <a href='JavaScript:' class="btn btn-default  btn-sm">支付方式</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">充值金额</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">充值时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">赠送金额</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">实际到账</a>
                </div>

                <div class="panel-heading tm tm-rw" style="display:none">充值退款</div>
                <div class="panel-body tm tm-rw" style="display:none">
                    <a href='JavaScript:' class="btn btn-default  btn-sm">支付方式</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">充值金额</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">充值时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">赠送金额</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">实际到账</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">退款金额</a>
                </div>

                <div class="panel-heading tm tm-rw" style="display:none">提现</div>
                <div class="panel-body tm tm-rw" style="display:none">
                    <a href='JavaScript:' class="btn btn-default  btn-sm">提现金额</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">提现时间</a>
                </div>
                <div class="panel-heading tm tm-order" style="display:none">
                    订单信息
                </div>
                <div class="panel-body tm tm-order" style="display:none">
                    <a href='JavaScript:' class="btn btn-default  btn-sm">商城名称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">粉丝昵称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">订单号</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">订单金额</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">运费</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">商品详情</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">单品详情</a>(单品商家下单通知变量)
                    <a href='JavaScript:' class="btn btn-default btn-sm">快递公司</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">快递单号</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">购买者姓名</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">购买者电话</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">收货地址</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">下单时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">支付时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">发货时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">收货时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">门店</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">门店地址</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">门店联系人</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">门店营业时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">虚拟物品自动发货内容</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">虚拟卡密自动发货内容</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">自提码</a>

                </div>
                <div class="panel-heading tm tm-order" style="display:none">
                    售后相关
                </div>
                <div class="panel-body tm tm-order" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">售后类型</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">申请金额</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">退款金额</a>

                    <a href='JavaScript:' class="btn btn-default btn-sm">退货地址</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">换货快递公司</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">换货快递单号</a>

                </div>

                <div class="panel-heading tm tm-order" style="display:none">
                    订单状态更新
                </div>
                <div class="panel-body tm tm-order" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm"></a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">粉丝昵称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">订单编号</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">原收货地址</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">新收货地址</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">订单原价格</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">订单新价格</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">修改时间</a>

                </div>
                <div class="panel-heading tm tm-commission" style="display:none">成为下级或分销商</div>
                <div class="panel-body tm tm-commission" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">昵称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">时间</a>
                </div>
                <div class="panel-heading tm tm-commission" style="display:none">新增下线通知</div>
                <div class="panel-body tm tm-commission" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">下线层级</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">下级昵称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">时间</a>
                </div>
                <div class="panel-heading tm tm-commission" style="display:none">下级付款类</div>
                <div class="panel-body tm tm-commission" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">下级昵称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">订单编号</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">订单金额</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">商品详情</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">佣金金额</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">下线层级</a>
                </div>
                <div class="panel-heading tm tm-commission" style="display:none">提现申请和佣金打款类</div>
                <div class="panel-body tm tm-commission" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">昵称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">金额</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">提现方式</a>
                </div>
                <div class="panel-heading tm tm-commission" style="display:none">分销商等级升级通知</div>
                <div class="panel-body tm tm-commission" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">昵称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">旧等级</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">旧一级分销比例</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">旧二级分销比例</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">旧三级分销比例</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">新等级</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">新一级分销比例</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">新二级分销比例</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">新三级分销比例</a>
                </div>



                <div class="panel-heading tm tm-globonus" style="display:none">成为股东</div>
                <div class="panel-body tm tm-globonus" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">昵称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">时间</a>
                </div>

                <div class="panel-heading tm tm-globonus" style="display:none">股东等级升级通知</div>
                <div class="panel-body tm tm-globonus" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">昵称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">旧等级</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">旧分红例</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">新等级</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">新分红比例</a>
                </div>
                <div class="panel-heading tm tm-globonus" style="display:none">分红发放通知</div>
                <div class="panel-body tm tm-globonus" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">昵称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">时间</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">打款方式</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">金额</a>
                </div>

                <div class="panel-heading tm tm-merch" style="display:none">入驻申请</div>
                <div class="panel-body tm tm-merch" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">商户名称</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">主营项目</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">联系人</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">手机号</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">申请时间</a>
                </div>
                <div class="panel-heading tm tm-merch" style="display:none">入驻申请(用户)</div>
                <div class="panel-body tm tm-merch" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">驳回原因</a>
                </div>

                <div class="panel-heading tm tm-login" style="display:none">登录/注册</div>
                <div class="panel-body tm tm-login" style="display:none">
                    <a href='JavaScript:' class="btn btn-default btn-sm">验证码</a>
                    <a href='JavaScript:' class="btn btn-default btn-sm">商城名称</a>
                </div>

                <div class="panel-footer">
                    点击变量后会自动插入选择的文本框的焦点位置，在发送给粉丝时系统会自动替换对应变量值
                    <div class="text text-danger">
                        注意：以上模板消息变量只适用于系统类通知，会员群发工具不适用
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

 
<script language='javascript'>
scope.pagedata.i=0;
scope.add = function(){
	scope.pagedata.i=scope.pagedata.i+1;
	if(scope.pagedata.i>5){
	alert('最多增加5条');
	}
	scope.$apply();
}
    
    $(function () {
        require(['jquery.caret'],function(){
            var jiaodian;
            $(document).on('focus', 'input,textarea',function () {
                jiaodian = this;
            });

            $("a[href='JavaScript:']").click(function () {
                if (jiaodian) {
                    $(jiaodian).insertAtCaret("["+this.innerText+"]" );
					scope.pagedata.item.data.s1=$("#s1").val();
					scope.pagedata.item.data.s2=$("#s2").val();
					scope.pagedata.item.data.s3=$("#s3").val();
					scope.pagedata.item.data.s4=$("#s4").val();
					scope.pagedata.item.data.s5=$("#s5").val();
					scope.$apply();
                }
            })

        });
    })
 
    </script>

